<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%
  String xm = this.getServletContext().getInitParameter("path");
	String path1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+xm;
%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> 
<html>
<head>
<title>客户信息列表</title>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="<%=path1%>/qt/yjs/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="<%=path1%>/qt/yjs/bootstrap.min.js"></script>
 

<link rel="stylesheet" type="text/css" href="<%=path1%>/qt/css/normalize.css" />
		<link rel="stylesheet" type="text/css" href="<%=path1%>/qt/fonts/font-awesome-4.2.0/css/font-awesome.min.css" />
		<link rel="stylesheet" type="text/css" href="<%=path1%>/qt/css/demo.css" />
		<link rel="stylesheet" type="text/css" href="<%=path1%>/qt/css/component.css" />
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/redmond/jquery-ui-1.8.2.custom.css"/>
<link type="text/css" rel="stylesheet" href="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/ui.jqgrid.css"/>  

<script type="text/javascript" src="<%=path1%>/scripts/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/jquery.jqGrid.src.js"></script>
<script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/i18n/grid.locale-cn.js"></script>
<script type="text/javascript" src="<%=path1%>/scripts/pagekage/utils/widget/jqGrid/jquery.jqGrid.min.js"></script>  
<link rel="stylesheet" href="<%=path1%>/qt/ycss/bootstrap.min.css"/>

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="<%=path1%>/qt/ycss/bootstrap-theme.min.css"/>
  <script  type="text/javascript">
   function ajaxUpdate123(){
	var payMent_name = $("#payMent_name").val();
	var payMent_money = $("#payMent_money").val();
	//alert(right);
     $.ajax({ 	
     data: {
    	 "payMent_name":payMent_name,
    	 "payMent_money":payMent_money,
    	 "contract_id":right
     	},  
     	type:"Post",  
     dataType: 'json',  
     url:"../qt/payment/addPayMent.do", 
     error:function(data){  
    	alert("系统繁忙，请稍后再试！")
     },  
     success:function(data){
    	 $('#payMent_name').val("");
		 $('payMent_money').val("")
    	  $('#myModal').modal('hide');
    	  jQuery("#list4").trigger("reloadGrid");
     }
      });  
    
  } 
     
	function sendMassage() {
		 $('#payMent_name').val("");
		 $('payMent_money').val("")
		 $('#myModal').modal('hide');
	}
</script>

<script type="text/javascript">
function unique(arr) {
	  var result = [], hash = {};
	  for (var i = 0, elem; (elem = arr[i]) != null; i++) {
	    if (!hash[elem]) {
	      result.push(elem);
	      hash[elem] = true;
	    }
	  }
	  return result;
	}
function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
           
    return currentdate;
}
$(document).ready(function(){
    var first_time=$("#first_time").val(getNowFormatDate());
    var second_time=$("#second_time").val(getNowFormatDate());
});
function loadorder(){
    sstrval = $("#first_party").val();
	customerNameVal = $("#second_party").val();
	payTypeName = $("#contract_state").val();
	var sstra ='';
	if(!(sstrval == '' || sstrval == null )){
		sstra = "and first_party ='"+sstrval+"'";
	}
	if(!(customerNameVal == '' || customerNameVal == null) ){
		sstra = sstra+ "and second_party ='"+customerNameVal+"'";
	}
	if(!(payTypeName == '' || payTypeName == null )){
		sstra = sstra+ "and contract_state ='"+payTypeName+"'";
	}
	console.log(sstra);
	$("#list4").jqGrid('setGridParam',{
		url:"./contract/selectBySql.do",
		type:"POST",
		postData:{"SearchSql":sstra},
        datatype:'json', 
          }).trigger("reloadGrid"); 

}
</script>
<script type="text/javascript">
var right =null;
$(document).ready(function(){
	var SeachSql;
	var id;
    var str=window.location.href; //得到listclient的地址
    //alert("str"+str);
    var es=/id=/; 
    es.exec(str); //得到地址后面变量名称
    //alert("es--"+es.exec(str));
    right=RegExp.rightContext;//得到地址后面变量名称的值
    //alert("right-"+right);3
     var str =null;
    if(!(right==null)){
    	console.log(right);
    	str = 'and wd_payment.contract_id ="'+right+'" order by payment_time desc';
    }
    console.log("str"+str);
    $("#list4").jqGrid({
        url:"./payment/selectPayMent.do?SearchSql="+str,   //自动查询
        PostData:str,
        datatype:"json", 
        mtype:"get",
        height:420,
        autowidth:true,
        colNames:[ 
				'编号','缴费人员','操作人员','缴费时间','缴费金额','剩余金额','总额'                  
                 ],
       colModel:[
			{name:'id', hidden:true, index:'id', width:'15%', align:'center'},
			{name:'payment_name',index:'payment_name', width:'15%', align:'center'},
			{name:'name',  index:'name', width:'15%', align:'center'},
			{name:'payment_time',index:'payment_time', width:'15%', align:'center'},
			{name:'payment_money',index:'payment_money', width:'15%', align:'center'},
			{name:'surplus',index:'surplus', width:'15%', align:'center'},
			{name:'total',index:'total', width:'15%', align:'center'},
		
				],
        rownumbers:true,
    
        //altRows:true,
        //sortname:'createDate',
        //sortorder:'asc',
        viewrecords: true,
        rowNum:5,
      
        multiselect: true,//复选框     
        rowList:[2,4,6,8,10,12],
        jsonReader:{
            id: "blackId",
            repeatitems : false
        },
        pager:$('#gridPager')
    });
});
</script>
<script type="text/javascript">  
 
    function ajaxInsert(){  
        $('#myModal').modal('show');
    }
    
    function ajaxUpdate(){  
    	
    	var customer_id=$('#list4').jqGrid('getGridParam','selrow');
    	if(customer_id==null)
    	{
    	alert("请选择要修改的行");
    	return;
    	}
       var rowData = $('#list4').jqGrid('getRowData',customer_id);
       updateid=rowData.order_id;
       window.location.href="updateOrder.jsp?id="+updateid;
        
     }  
    function ajaxDelete(){  
    	
        var customer_id=$('#list4').jqGrid('getGridParam','selrow');
        if(customer_id==null)
        	{
        	alert("请选择要删除的行");
        	return;
        	}
        var rowData = $('#list4').jqGrid('getRowData',customer_id);
        delid=rowData.contract_id;
         
        $.ajax({   
        data: {contract_id:delid},  
        type:"Post",  
        dataType: 'json',  
         url:"../qt/payment/deletePayMent.do",  
         error:function(data){  
             alert("出错了！！");  
         },  
        success:function(data){  
        	$("#list4").jqGrid('setGridParam',{ 
                datatype:'json', 
                postData:{'pageSize':10,'pageIndex':1,'SearchSql':""}, // 发送数据   
                page:1 
            }).trigger("reloadGrid"); 
        	 
         }  
         });  
     } 
    function ajaxSelect(){  
        var SearchSql ="";
        var first_time=$("#first_time").val();
        var second_time=$("#second_time").val();
        SearchSql = "and payment_time BETWEEN "+first_time +" and "+second_time;
          	$("#list4").jqGrid('setGridParam',{ 
              datatype:'json', 
              postData:{'SearchSql':SearchSql}, // 发送数据     //  where name like '%"+$("#name").val()+"%'
              url:"./payment/selectPayMent.do",
              page:1 
          }).trigger("reloadGrid");  
           
     } 
</script> 
<script type="text/javascript">
    function gotoaddreceive(){
    	var customer_id=$('#list4').jqGrid('getGridParam','selrow');
    	if(customer_id==null)
    	{
    	alert("请选择要修改的行");
    	return;
    	}
       var rowData = $('#list4').jqGrid('getRowData',customer_id);
       updateid=rowData.contract_id;
       console.log(updateid)
    	 $.ajax({
			 url:"./contract/updateContractState.do",
			 data:{'contract_id':updateid},
			 success:function(data){
				window.location.href="listContract.jsp" 
			 }
			 });
    }
    
</script>
</head>
<body>
<div id="gridPager"></div>
<div class="yboxwidth boxcenter ybox01" style="width: 100%">
<div class="ybox09" style="width: 100%" >
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
       <td  style="padding-left: 30px ">
       <table width="100%"  border="0"  cellspacing="0" cellpadding="0">
          <tr valign="top">
            <td class="ybox11td5" ></td>
            <td class="ybox11td6" >缴费记录管理</td>
            <td class="ybox11td7"></td>
            <td class="ybox11td2"></td>
            <td class="ybox11td3"></td>
            <td class="ybox11td2"></td>
            <td class="ybox11td3"></td>
            <td class="ybox11td2"></td>
            <td class="ybox11td4"></td>    
             <td class="ybox11td4"></td>   
               <td class="ybox11td4"></td>   
                 <td class="ybox11td4" ></td>    
          </tr>
        </table>
        </td>
        </tr>
    </table>
  </div>
  
  <div class="ybox02">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="margb4">
      <tr>
        <td class="ybox03td1"></td>
        <td class="ybox03td2"></td>
        <td class="ybox03td3"></td>
      </tr>
      <tr>
        <td class="ybox03td4"></td>
        <td class="ybox03td5"><div class="ybox05 margb8">
          <dl>
            <dt> <strong></strong>&nbsp;&nbsp;
               <!--   订单单号：<input type="text" id="customer_name"/> &nbsp;&nbsp;&nbsp;&nbsp; -->  
	              缴费时间段：<input style="width: 150px;" id="first_time" class="Wdate" onclick="WdatePicker()"/>
                  <input style="width: 150px;" id="second_time" class="Wdate" onclick="WdatePicker()"/>
	        
	       <img onclick="ajaxSelect()" src="images/bottonselect.gif" width="50" height="20" style="vertical-align: middle;cursor: pointer;" />
	           </dt>
          </dl>
        </div>
          <div class="ybox07 margb2">
            
      <dl><table border="0" cellspacing="0" cellpadding="0" class="ybox07table" width="100%">
              <tr align="left">
                <td class="ybox07td1"><img src="images/op4_1.gif" /></td>
                <td><span style="cursor:pointer;" onclick="ajaxInsert()">添加记录</span></td>
                <td class="ybox07td2" width="10px"><img src="images/op4_0.gif" /></td>
                <td class="ybox07td1"><img src="images/op4_3.gif" /></td>
                <td><span style="cursor:pointer;" onclick="ajaxDelete()">移除记录</span></td>
                <td class="ybox07td2" width="72%"><img src="images/op4_0.gif" /></td>
                <td class="ybox07td2"><img src="images/op4_0.gif" /></td>
                <td class="ybox07td1" ><img src="images/op6_1.gif" width="15" height="16"/></td>
                <td ></td>
                <!-- gotoaddreceive() -->
                <td class="ybox07td2" ></td>
               
              </tr>
          </table>
          </dl>
          </div>	
          <table width="100%" border="0" cellpadding="0" cellspacing="1" class="ybox06table" id="list4">
                
          </table>
        
        <td class="ybox03td6"></td>
      </tr>
      <tr>
        <td class="ybox03td7"></td>
        <td class="ybox03td8"></td>
        <td class="ybox03td9"></td>
      </tr>
    </table>
  </div>
</div>

   <!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content" style="height: 400px; width: 420px">
      <div class="modal-header" style="background:#438eb9;">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">添加缴费记录</h4>
      </div>
  <!--  <div class="col-sm-10">
     验证码： <input type="text" class="form-control" id="role_name" placeholder="role_name"/>
    </div>
 -->    <span class="input input--haruki">
			<input class="input__field input__field--haruki" type="text" id="payMent_name" name="payMent_name" />
			<label class="input__label input__label--haruki" for="input-1">
				<span class="input__label-content input__label-content--haruki">缴费人姓名</span>
			</label>
		</span>
            <span class="input input--haruki">
			<input class="input__field input__field--haruki" type="text" id="payMent_money" name="payMent_money" />
			<label class="input__label input__label--haruki" for="input-1">
				<span class="input__label-content input__label-content--haruki">缴费金额</span>
			</label>
		</span>
 
      
       <div class="modal-footer">
        <input type="button" onclick="ajaxUpdate123()" value="　提　交 　" class="btn btn-success"/>
        <button type="button" class="btn btn-success" onclick="sendMassage()"> &nbsp; 关  &nbsp; 闭 &nbsp;  </button>
      </div>
   
    </div>
  </div>
</div>



<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
  <div class="modal-dialog" role="document">
    <div class="modal-content" style="height: 500px; width: 420px">
      <div class="modal-header" style="background:#438eb9;">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">验证签约信息</h4>
      </div>
   
      <div class="modal-body">
 <div class="form-group" >
     <div id="massageid" style="width: 80%">
          <label for="inputEmail3"  class="col-sm-2 control-label" style="width: 100%">
          <span class="input__label-content input__label-content--haruki">缴费人姓名</span>
         </label>
    </div>
     </div>
     </div>
  <!--  <div class="col-sm-10">
     验证码： <input type="text" class="form-control" id="role_name" placeholder="role_name"/>
    </div>
 --> 
            <span class="input input--haruki" style="height:50px;" >
			<input class="input__field input__field--haruki" type="text" id="input-1" />
			<label class="input__label input__label--haruki" for="input-1">
				<span class="input__label-content input__label-content--haruki">缴费金额</span>
			</label>
		</span>
 
      
       <div class="modal-footer">
        <input type="button" onclick="ajaxUpdate123()" value="　提　交 　" class="btn btn-success"/>
        <button type="button" class="btn btn-success" onclick="sendMassage()">　啊重新发送　</button>
      </div>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font >
                   如果60秒内没有接收到消息，请点击重新发送。
      </font>

    </div>
  </div>
</div>
</body>
</html>